package com.jt.pojo;

import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class Result {
    private static final long serialVersionUID = 1L;

    private Object data;

    private String message;

    private Integer code;

    public static Result success(Object data) {
        Result result = new Result();
        result.setData(data);
        result.setCode(200);
        result.setMassage(data.toString());
        return result;
    }

    public static Result error(String message) {
        Result result = new Result();
        result.setMessage(message);
        result.setCode(500);
        return result;
    }

    public Result(Object data, String message, Integer code) {
        this.data = data;
        this.message = message;
        this.code = code;
    }

    public Result(Object data, Integer code, String message) {
        this.data = data;
        this.code = code;
        this.message = message;
    }

    public Result() {
    }

    public Result setMassage(String msg) {
        return this.setMessage(msg);
    }
}
